<%
/* Copyright 2010 Assert Developments
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<html>
    <head>
        <title><f:message key="account.title"/></title>
        <link rel="stylesheet" type="text/css" href="../../css/account.css"/>
    </head>
    <body>
        <!-- header -->
        <div id="header">
        </div>
        
        <!-- menu -->
        <div id="menu">
            <ul>
                <li id="menuhome"><a href="#"><f:message key="account.menu.home"/></a></li>
                <li id="menuprojects"><a href="#"><f:message key="account.menu.projects"/></a></li>
                <li id="menuhours"><a href="#"><f:message key="account.menu.hours"/></a></li>
            </ul>
        </div>

        <!-- contents -->
        <div id="contents">

            <!-- errors -->
            <c:if test="${not empty errors}">
                <div id="info">
                    <h3><f:message key="account.errors"/></h3>
                    <ul>
                        <c:forEach var="error" items="${errors}">
                            <li><f:message key="account.${error.value}"/></li>
                        </c:forEach>
                    </ul>
                </div>
            </c:if>

            <!-- mandatory info -->
            <div id="mandatory"><f:message key="account.mandatory"/></div>

            <!-- help -->
            <div id="help">
                <h2><f:message key="account.help.title"/></h2>
                <p><f:message key="account.help"/></p>
            </div>

            <!-- account details form -->
            <form method="POST" action="account">
                <fieldset id="details">
                    <legend><f:message key="account.legend"/></legend>

                    <!-- email -->
                    <div>
                        <label for="email"><f:message key="account.email"/></label>
                        <input type="text" name="email" value="${user.email}"/>
                        <span class="mandatorystar"><f:message key="account.mandatory.star"/></span>
                        <c:if test="${errors['user.email'] ne null}">
                            <div class="error">
                                <strong><f:message key="account.${errors['user.email']}"/></strong>
                            </div>
                        </c:if>
                    </div>

                    <!-- name -->
                    <div>
                        <label for="name"><f:message key="account.name"/></label>
                        <input type="text" name="name" value="${user.name}"/>
                        <span class="mandatorystar"><f:message key="account.mandatory.star"/></span>
                        <c:if test="${errors['user.name'] ne null}">
                            <div class="fielderror">
                                <strong><f:message key="account.${errors['user.name']}"/></strong>
                            </div>
                        </c:if>
                    </div>

                    <!-- description -->
                    <div>
                        <label for="description"><f:message key="account.description"/></label>
                        <textarea name="description">${user.description}</textarea>
                        <c:if test="${errors['user.description'] ne null}">
                            <div class="fielderror">
                                <strong><f:message key="account.${errors['user.description']}"/></strong>
                            </div>
                        </c:if>
                    </div>

                    <!-- country -->
                    <div>
                        <label for="country"><f:message key="account.country"/></label>
                        <select name="country">
                            <c:forEach var="country" items="${countries}">
                                <option value="${country}"
                                    <c:if test="${country eq user.country}">
                                        selected=selected
                                    </c:if>><f:message key="country.${country}"/></option>
                            </c:forEach>
                        </select>
                        <c:if test="${errors['user.country'] ne null}">
                            <div class="fielderror">
                                <strong><f:message key="account.${errors['user.country']}"/></strong>
                            </div>
                        </c:if>
                    </div>

                    <!-- language -->
                    <div>
                        <label for="language"><f:message key="account.language"/></label>
                        <select name="language">
                            <c:forEach var="language" items="${languages}">
                                <option value="${language}"
                                    <c:if test="${language eq user.language}">
                                        selected=selected
                                    </c:if>><f:message key="language.${language}"/></option>
                            </c:forEach>
                        </select>
                        <c:if test="${errors['user.language'] ne null}">
                            <div class="fielderror">
                                <strong><f:message key="account.${errors['user.language']}"/></strong>
                            </div>
                        </c:if>
                    </div>

                    <!-- timezone -->
                    <div>
                        <label for="timezone"><f:message key="account.timezone"/></label>
                        <select name="timezone">
                            <c:forEach var="timezone" items="${timezones}">
                                <option value="${timezone}"
                                    <c:if test="${timezone eq user.timezone}">
                                        selected=selected
                                    </c:if>>${timezone}</option>
                            </c:forEach>
                        </select>
                        <c:if test="${errors['user.timezone'] ne null}">
                            <div class="fielderror">
                                <strong><f:message key="account.${errors['user.timezone']}"/></strong>
                            </div>
                        </c:if>
                    </div>
                </fieldset>

                <!-- buttons -->
                <div id="buttons">
                    <input type="submit" value="<f:message key='account.save'/>"/>
                </div>
            </form>
        </div>

        <!-- footer -->
        <div id="footer">
        </div>

    </body>
</html>